<!--
 * @Description: 项目管理 - 主页面
 * @Author: DSY
 * @Date: 2022-03-14 21:48:53
 * @LastEditors: DHL
 * @LastEditTime: 2022-11-22 17:42:12
-->
<template>
  <tw-layout @refresh="handleRefresh" @search="handleSearch" @reset="handleReset">
    <!-- 按钮组 -->
    <template #btns>
      <el-button class="item" type="primary" @click="handleOpenForm('add')">
        <svg-icon iconClass="plus"></svg-icon>
        新增
      </el-button>
      <!--<el-button
        class="item"
        type="danger"
        :loading="loadingByDel"
        :disabled="isSelectRows"
        @click="handleDelete()"
      >
        <svg-icon iconClass="delete"></svg-icon>
        批量删除
      </el-button>-->
    </template>

    <!-- 查询表单 -->
    <template #header>
      <el-form ref="searchFormRef" :model="searchForm" label-width="90px">
        <el-row>
          <el-col :span="6">
            <el-form-item label="编号">
              <el-input v-model="searchForm.id" clearable placeholder="请输编号"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="项目名称">
              <el-input v-model="searchForm.name" clearable placeholder="请输项目名称"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="项目编码">
              <el-input v-model="searchForm.code" clearable placeholder="请输项目编码"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="接入ID">
              <el-input v-model="searchForm.appId" clearable placeholder="请输接入ID"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="接入Token">
              <el-input
                v-model="searchForm.appToken"
                clearable
                placeholder="请输接入Token"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="接入密钥">
              <el-input
                v-model="searchForm.appSecret"
                clearable
                placeholder="请输接入密钥"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="项目类型">
              <el-select v-model="searchForm.appType" clearable placeholder="请选择项目类型">
                <tw-dic dicKey="PROJECT_TYPE"></tw-dic>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="IP地址">
              <el-input v-model="searchForm.ipAddr" clearable placeholder="请输IP地址"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="端口号">
              <el-input v-model="searchForm.portCode" clearable placeholder="请输端口号"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="域名">
              <el-input v-model="searchForm.webAddr" clearable placeholder="请输域名"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="接入状态">
              <el-select v-model="searchForm.status" clearable placeholder="请选择接入状态">
                <tw-dic dicKey="PROJECT_STATUS"></tw-dic>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </template>

    <!-- 数据表格 -->
    <tw-table
      ref="tableRef"
      :loading="loading"
      :options="tableOptions"
      :events="tableEvents"
      :data="tableData"
      @search="searchList"
    >
      <template #action="{ row }">
        <el-button link type="warning" @click="handleOpenForm('edit', row)">编辑</el-button>
        <el-button link type="danger" @click="handleDelete(row)">删除</el-button>
      </template>
    </tw-table>

    <projectForm ref="formRef" @refreshTableData="handleRefresh"></projectForm>
  </tw-layout>
</template>

<script src="./useIndex.ts"></script>

<style scoped lang="scss"></style>
